import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:getx_learn/common/routes/app_pages.dart';

class RouteAuthMiddleware extends GetMiddleware {
  @override
  int? priority = 0;

  RouteAuthMiddleware({required this.priority});

  @override
  RouteSettings? redirect(String? route) {
    Future.delayed(Duration(seconds: 1), () => Get.snackbar("提示", "请先登录"));
    // 返回具体配置，表示拦截
    // return RouteSettings(name: AppRoutes.Login);
    // 返回 null，表示不拦截
    return null;
  }
}
